package com.huibei.wateradmin.authority.message;


import com.huibei.wateradmin.authority.domain.Menu;

import java.util.List;

/**
 * Created by wanglinlin on 2016/7/17.
 */
public class ClientMenuTreeInfo {
    Long id;
    Long pId;
    String name;
    Boolean checked;

    public ClientMenuTreeInfo() {
    }

    public ClientMenuTreeInfo(Long id, Long pId, String name, Boolean checked) {
        this.id = id;
        this.pId = pId;
        this.name = name;
        this.checked = checked;
    }
    public ClientMenuTreeInfo(Menu menu, List<Menu> roleMenus) {
        this.id = menu.getId();
        this.pId = menu.getParentMenu()==null?0:menu.getParentMenu().getId();
        this.name = menu.getName();
        this.checked = roleMenus.contains(menu);
    }

    public static ClientMenuTreeInfo convertToClient(Menu menu, List<Menu> roleMenus) {
        return new ClientMenuTreeInfo(menu ,roleMenus);
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getpId() {
        return pId;
    }

    public void setpId(Long pId) {
        this.pId = pId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Boolean getChecked() {
        return checked;
    }

    public void setChecked(Boolean checked) {
        this.checked = checked;
    }
}
